local qiyuandan = fk.CreateSkill{
    name = "ym2__qiyuandan",
}
Fk:loadTranslationTable{
    ["ym2__qiyuandan"] = "起源弹",
    [":ym2__qiyuandan"] = "你可废除一个装备栏，视为使用【杀】。受到此【杀】伤害的角色选择一项：1.此伤害+X（X为其的技能数）；2.失去一项技能。",
    ["#ym2__qiyuandan-choice"] = "起源弹：失去一个技能，或令此伤害+%arg",

    ["$ym2__qiyuandan1"] = "卑怯と思うか？なら、それがお前の敗因だ",
    ["$ym2__qiyuandan2"] = "さあ、ついてこれるか。『時のある間に薔薇を摘め』",
}
qiyuandan:addEffect("viewas",{
    pattern = "slash",
    anim_type = "offensive",
    interaction = function()
        local all_choices = {"WeaponSlot", "ArmorSlot", "DefensiveRideSlot", "OffensiveRideSlot", "TreasureSlot"}
        local subtypes = {Card.SubtypeWeapon, Card.SubtypeArmor, Card.SubtypeDefensiveRide, Card.SubtypeOffensiveRide, Card.SubtypeTreasure}
        local choices = {}
        for i = 1, 5, 1 do
            if #Self:getAvailableEquipSlots(subtypes[i]) > 0 then
                table.insert(choices, all_choices[i])
            end
        end
        if #choices > 0 then
            return UI.CardNameBox { choices = choices, all_choices = all_choices }
        end
    end,
    card_filter = Util.FalseFunc,
    view_as = function (self, player, cards)
        if not self.interaction.data then return end
        local card = Fk:cloneCard("slash")
        card.skillName = self.name
        return card
    end,
    before_use = function(self, player, use)
        local room = player.room
        room:abortPlayerArea(player, {self.interaction.data})
    end,
})
qiyuandan:addEffect(fk.DamageCaused,{
    can_refresh = function (self, event, target, player, data)
        return data.card and data.card.skillName == "ym2__qiyuandan" and target == player
    end,
    on_refresh = function (self, event, target, player, data)
        local room = player.room
        local skills = {}
        local to = data.to
        for _, skill in ipairs(to.player_skills) do
            if skill:isPlayerSkill(to) and not skill.name:startsWith("#") then
                  table.insertIfNeed(skills, skill.name)
            end
        end
        table.insert(skills,"Cancel")
        local choice = "Cancel"
        if #skills > 1 then
            choice = room:askToChoice(to, {
                choices = skills,
                skill_name = self.name,
                prompt = "#ym2__qiyuandan-choice:::"..(#skills-1),
                detailed = true,
            })
        end
        if choice == "Cancel" then
            data.damage = data.damage + #skills - 1
        else
            room:handleAddLoseSkills(to, "-"..choice)
        end
    end,
})
return qiyuandan